package de.negativrekord.blockworld;

import cc.creativecomputing.CCApp;

public class BlockWorldDemo extends CCApp {

	/*
	private BlockWorld _myBlockWorld;

	private CCGLSLShader _myDisplayShader;
	private CCGLSLShader _myBrickShader;

	@Override
	public void setup() {

		_myDisplayShader = new CCGLSLShader(null, CCIOUtil.classPath(this, "shader/display_fp.glsl"));
		_myDisplayShader.load();

		_myBrickShader = new CCGLSLShader(
			CCIOUtil.classPath(ABrickShaderDemo.class, "brick_vertex.glsl"), 
			CCIOUtil.classPath(ABrickShaderDemo.class, "brick_fragment.glsl")
		);
		_myBrickShader.load();
		
		
		addControls("app", "app", this);
		
		recalc();
	}
	
	
	@Override 
	public void draw() {
		
		CCVector3f center = new CCVector3f(1000,1000,-1000);
		CCVector3f dir = _myCameraPath.direction().scale(1000);
 		CCVector3f pos = _myCameraPath.currentPos();
		CCVector3f up  = new CCVector3f(pos).subtract(center).normalize();
 		
 		CCLog.info(pos+" "+dir+" "+up);
		

//		_myCameraWrapper.pan(_myCameraPath.pan());
//		_myCameraWrapper.tiltUD(frameCount*0.03f);
		
		//_myCameraWrapper.up(new CCVector3f(_myCameraPath.currentPos()).subtract(0,0,0));
 		
 		_myCameraWrapper.position(new CCVector3f(4000,4000,0));
 		_myCameraWrapper.up(new CCVector3f(0,1,0));
		_myCameraWrapper.target(new CCVector3f(1000,1000,-1000));
		
		_myCameraWrapper.update();
		//_myCameraWrapper.tiltLR(_myCameraPath.tiltLR());
		

		_myCameraPath.move(3f);
		
		g.clear();
		
		
		_myBrickShader.start();
		//_myBlockCreator.mesh().draw(g);	

 		g.pushMatrix();
		//g.rotateX(90);
		g.translate(0,0,0);
		_myBlockCreator.mesh().draw(g);
		g.popMatrix();
		
		g.pushMatrix();
		g.rotateY(180);
		g.translate(-W*MAP_W,0,W*MAP_W);
		_myBlockCreator.mesh().draw(g);
		g.popMatrix();
		
		g.pushMatrix();
		g.rotateY(90);
		g.translate(0,0,0);
		_myBlockCreator.mesh().draw(g);
		g.popMatrix();
		
		g.pushMatrix();
		g.rotateY(90);
		g.translate(0,0,W*MAP_W);
		_myBlockCreator.mesh().draw(g);
		g.popMatrix();
		
		g.pushMatrix();
		g.translate (0,W*MAP_W,0);
		g.rotateX(270);
		_myBlockCreator.mesh().draw(g);
		g.popMatrix();
		
		g.pushMatrix();
		g.translate(0,0,-W*MAP_W);
		g.rotateX(90);
		_myBlockCreator.mesh().draw(g);
		g.popMatrix();
		
		_myBrickShader.end();
		
		g.color(1f,0,0);
		g.pushMatrix();
		g.translate(pos);
		g.box(30,30,30);
		g.popMatrix();
		g.line(pos,dir);
		
		
		_myBlockWorld = new BlockWorld(g);
		addControls("app", "app", _myBlockWorld);
		_myBlockWorld.recalc();
	}


	public static void main(String[] args) {
		CCApplicationManager manager = new CCApplicationManager(BlockWorldDemo.class);
		manager.settings().size(1200, 800);
		manager.start();
	}
	
	*/
}
